What is strip-ansi?
The strip-ansi npm package is used to remove ANSI escape codes from strings. These codes are often used to provide coloring and formatting in terminal output, but they can be problematic when the text needs to be processed without these codes, such as logging to a file or displaying in a GUI.
Strip ANSI escape codes from a string
This feature allows you to remove any ANSI escape codes from a given string, leaving only the plain text without any formatting or color.
const stripAnsi = require('strip-ansi');
const coloredString = '\u001B[4mUnicorn\u001B[0m';
const strippedString = stripAnsi(coloredString);
console.log(strippedString); // 'Unicorn'